<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5shiv.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>测试用例运行结果</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 我的用例 <span class="c-gray en">&gt;</span>用例运行结果</nav>
<div class="page-container">
    <div >
        <div style="margin-left:30px;margin-top:20px;">
            <label style="margin-left:65px;font-weight: bold;">服务：</label><input type="text" name="servicekey" id="servicekey" placeholder=" " style="width:12%;" class="input-text" disabled=true>
            <label style="margin-left:78px;font-weight: bold;">请求方式：</label><input type="text" name="requestMethod" id="requestMethod" placeholder=" " style="width:12%;" class="input-text" disabled=true>
            <label style="margin-left:50px;font-weight: bold;">接口地址：</label><input type="text" name="tiUrl" id="tiUrl" placeholder=" " style="width:15%;" class="input-text" disabled=true>
        </div>
        <div style="margin-left:30px;margin-top:20px;">
            <label style="margin-left:2px;font-weight: bold;">ContentType：</label><input type="text" name="contentType" id="contentType" placeholder=" " style="width:12%;" class="input-text"  disabled=true>
            <label style="margin-left:50px;font-weight: bold;">请求参数类型：</label><input type="text" name="prarmType" id="prarmType" placeholder=" " style="width:12%;" class="input-text"  disabled=true>
        </div>
       <!-- <div class="row cl">
            <label class="col-xs-4" style="width:100px;margin-left:65px;margin-top:20px;">请求参数：</label>
            <div class="formControls col-xs-8 col-sm-9" style="margin-top:20px;">
                <textarea id="param" name="param" cols="" rows="" class="textarea valid" style="width:68%;"></textarea>
            </div>
        </div>-->
        <div style="margin-left:30px;margin-top:20px;">
            <label style="margin-left:10px;float: left;font-weight: bold;">用例设计参数：</label>
            <div>
                <textarea id="param" name="param" cols="" rows="" style="width: 53%;height: 200px;margin-top:5px;border: solid 1px #ddd;padding:10px;"  disabled=true></textarea>
            </div>
        </div>
    </div>

    <div id="DataTables_Table_0_wrapper" class="dataTables_wrapper no-footer" style="margin-top:20px;">
        <table class="table table-border table-bordered table-bg table-hover table-sort" id="table">
            <thead>
            <tr class="text-c">
                <th width="5%">环境</th>
                <th width="10%">请求host</th>
                <th width="5%">断言类型</th>
                <th width="20%">请求参数</th>
                <th width="20%">预期结果</th>
                <th width="30%">实际结果</th>
                <th width="10%">测试结果</th>
            </tr>
            </thead>
            <tbody id="testResultList">
            </tbody>
        </table>
    </div>
</div>
<script type="text/javascript" src="static/hry-auto/util.js"></script>
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
    var layerIndex;
    var res;
    //初始加载
    $(document).ready(function () {
        layerIndex = layer.load(1, { shade: [0.01, '#fff'] });
        window.addEventListener('message',function(event) {
            //if(event.origin !== 'http://localhost:8885') return;
            console.log('received response:  ',event.data);
            res = event.data.data;

            var service = res.serviceKey;;
            var requestMethod = res.requestMethod;
            var iuri = res.iuri;
            var param = res.param;
            var contentType = res.contentType;
            var prarmType = res.prarmType;
            var expected = res.expected;
            var assertType = res.assertType;
            var list = res.runOneResultSubList;

            $("#servicekey").val(service);
            $("#requestMethod").val(requestMethod);
            $("#tiUrl").val(iuri);
            $("#contentType").val(contentType);
            $("#prarmType").val(prarmType);
            $("#param").val(param);

            var html="";
            var t="tr";
            var css="";
            for(var i=0;i<list.length;i++){
                t=t+i;
                row=list[i];
                if(row.result == "FAIL"){
                    css="#b21919";
                }else if(row.result == "PASS"){
                    css="#08ad16";
                }
                var rowHtml = "<tr class=\"text-c\" id="+t+">\n" +
                    "<td>"+row.env+"</td>\n" +
                    "<td>"+row.hostInfo+"</td>\n" +
                    "<td>"+assertType+"</td>\n" +
                    "<td><xmp>"+row.actualParam+"></xmp></td>"+
                    "<td>"+expected+"</td>\n" +
                    "<td >"+row.actual+"</td>\n" +
                    "<td>"+row.result+"</td>\n" +
                    "</tr>";
                html = html + rowHtml;

            }
            $("#testResultList").append(html);
            layer.close(layerIndex);
            $("#"+t).css("background-color",css);



        },false);




    });





</script>
</body>
</html>